#ifndef SOCKET_HANDLING_H
#define SOCKET_HANDLING_H

#include <assert.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <time.h>

#include "debug.h"

#include "messageHandler.h"
#include "messageComputer.h"

static const int TCP_PROTOCOL_NUMBER = 6;
static const int PORT = 60001;
static const int MAX_CLIENT = 42;


typedef struct
{
  int socketFd;
  struct sockaddr_in* connectionInfo;
  int connectionNumber;
  int* connectionState;
} peerConnectionData;

int waitForConnection(int socketFd, int* connectionState, int connectionId,
		       pthread_t* threads);
int getNextConnectionId(int * connectionState, int size);
void peerDialog(void* cd);
message* waitForCommand(peerConnectionData* connectionData);
#endif // SOCKET_HANDLING_H








